// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_BPT_DRAW_BLUEPRINT_ITEM
// * CreateDate    : 2011/8/16 10:16:40
// * Creater       : CodeSmith
// * LastChangeDate: 2011/8/16 10:16:40
// * LastChanger   : 2011/8/16 10:16:40
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Bpt
{
/// <summary>
    /// BptDrawBlueprintItem
    /// </summary>
    public partial class BptDrawBlueprintItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objBptDrawBlueprintItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static BptDrawBlueprintItemEntity GetBptDrawBlueprintItem(BptDrawBlueprintItemEntity objBptDrawBlueprintItemEntity)
        {
            return DataAccess.SelectSingle<BptDrawBlueprintItemEntity>(objBptDrawBlueprintItemEntity);
        }
        public static DataTable GetDrawBuleItemByID(string DrawBuleID)
        {
            string sql = "select a.*,b.TASK_CODE,c.BLUEPRINT_CODE ,p.product_name,product_code from dbo.BPT_DRAW_BLUEPRINT_ITEM A left join dbo.BPT_DRAW_BLUEPRINT B on a.DRAW_BLUEPRINT_ID=b.DRAW_BLUEPRINT_ID left join dbo.BPT_BLUEPRINT c on a.BLUEPRINT_ID=c.BLUEPRINT_ID left join mst_product P on c.product_id=p.product_id where A.DRAW_BLUEPRINT_ID= '" + DrawBuleID + "'";
            DataSet ds = new DataSet();
            ds = DataAccess.SelectDataSet(sql);
            if (ds != null && ds.Tables.Count > 0)
            {
                return ds.Tables[0];
            }
            return null;

        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objBptDrawBlueprintItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertBptDrawBlueprintItem(BptDrawBlueprintItemEntity objBptDrawBlueprintItemEntity)
        {
            return DataAccess.Insert(objBptDrawBlueprintItemEntity);
        }

        public static bool InsertBptDrawBlueprintItem(List<BptDrawBlueprintItemEntity> objBptDrawBlueprintItemEntityList)
        {
            return DataAccess.Insert(objBptDrawBlueprintItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objBptDrawBlueprintItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateBptDrawBlueprintItem(BptDrawBlueprintItemEntity objBptDrawBlueprintItemEntity)
        {
            return DataAccess.Update(objBptDrawBlueprintItemEntity);
        }

        public static bool UpdateBptDrawBlueprintItem(List<BptDrawBlueprintItemEntity> objBptDrawBlueprintItemEntityList)
        {
            return DataAccess.Update<BptDrawBlueprintItemEntity>(objBptDrawBlueprintItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objBptDrawBlueprintItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteBptDrawBlueprintItem(BptDrawBlueprintItemEntity objBptDrawBlueprintItemEntity)
        {
            return DataAccess.Delete(objBptDrawBlueprintItemEntity);
        }

        public static bool DeleteBptDrawBlueprintItem(List<BptDrawBlueprintItemEntity> objBptDrawBlueprintItemEntityList)
        {
            return DataAccess.Delete<BptDrawBlueprintItemEntity>(objBptDrawBlueprintItemEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetBptDrawBlueprintItemAll()
        {
            return DataAccess.SelectAllDataSet<BptDrawBlueprintItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<BptDrawBlueprintItemEntity> GetBptDrawBlueprintItemAllList()
        {
            return DataAccess.SelectAll<BptDrawBlueprintItemEntity>();
        }

        public static List<BptDrawBlueprintItemEntity> GetBptDrawBlueprintItemListByID(string DrawID)
        {
            if (string.IsNullOrEmpty(DrawID))
            {
                return null;
            }
            BptDrawBlueprintItemEntity entity = new BptDrawBlueprintItemEntity();
            entity.DrawBlueprintId = DrawID;
            return DataAccess.Select<BptDrawBlueprintItemEntity>(entity);
        }
        #endregion
	}
	
	
}	

